﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="mfUserRegister.aspx.cs" Inherits="msBsc.WebUi.mMall.Public.mfUserRegister" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>手机地接客商城</title>
    <%=getMeta()%>
    <link rel="stylesheet" type="text/css" href="/themes/mStyle1/mGlobal.css" charset="gbk" />
    <link rel="stylesheet" type="text/css" href="/themes/mStyle1/css/public/mLogin.css" charset="gbk" />
    <link rel="stylesheet" type="text/css" href="/themes/mStyle1/css/home/base.css" charset="gbk" />
    <%=getBodyBeforeJs()%>
    <script src="/??jqPlugin/js/jquery-1.8.3.min.js,js/jBase.js,js/jmPage.js,themes/Style1/jsQt.js,jqPlugin/js/laytpl.js,themes/wStyle1/js/comm/VerifyJs.js"
        type="text/javascript"></script>
    <script type="text/javascript">
        $(window).load(function () {
        });
        //        $(window).bind('resize', function () { _self._ResizeHandler(_self); })
        //        .bind('scroll', function () { _self._ResizeHandler(_self); });
    </script>
    <!--head fix rgn-->
    <style type="text/css">
        .c_title {
            width: 115px !important;
        }

        .btn {
            background: #69cd38;
        }

            .btn:hover {
                background: #70d83d;
            }
    </style>
    <base target="_self" />
</head>
<body>
    <div class="viewport">
        <%=msBsc.WebUi.Code.QtHtmlGet.GetWapHeaderMenuHtml(false) %>
       
        <form action='#' method="post" id="J_EmailForm">

            <input type="hidden" name="invatationCode" id="invatationCode" value="" />
            <input type="hidden" name="txtRetUrl" id="txtRetUrl" value="" />
            <div class="new-txt-err" id="err" style="display: none;">
            </div>
            <div>
                <div class="c_input">
                    <div class="c_text">
                        <input type="text" value="" name="username" id="username" placeholder="请输入用户名/邮箱" />
                        <a class="input_user"></a>
                    </div>
                </div>

            </div>
            <div>
                <div class="c_input">
                    <%--<div class="c_title"><a style="margin-right: 10px">密码:</a></div>--%>
                    <div class="c_text">
                        <input type="password" value="" name="username" id="password" placeholder="请输入密码" />
                        <a class="input_pwd"></a>
                    </div>
                </div>
            </div>
            <div>
                <div class="c_input">
                    <%--<div class="c_title"><a style="margin-right: 10px">确认密码:</a></div>--%>
                    <div class="c_text">
                        <input type="password" value="" name="username" id="okPassword" placeholder="请输入确认密码" />
                        <a class="input_pwd"></a>
                    </div>
                </div>
            </div>
            <div>
                <div class="c_input">
                    <%--<div class="c_title"><a style="margin-right: 10px">验证码:</a></div>--%>
                    <div class="c_text">
                        <input type="text" value="" name="username" id="txtValidata" class="v_input" style="padding-right: 0px !important;" placeholder="请输入验证码" />
                    </div>
                    <div class="c_code">
                        <div id="imgValidata" class="img_code" style=""></div>
                    </div>
                </div>
            </div>
            <input type="hidden" id="remember" value="true" name="remember" />
            <div>
                <input type="button" class="btn btn-large btn_size" id="J_BtnEmailForm" value="注册" />
            </div>
            <div style="margin-top: 20px; padding-left: 10px;">
                <input type="checkbox" id="chkAgreeProtecol" checked="checked" /><label for="chkAgreeProtecol">我已阅读并同意 </label>
                <a href="/m/mp_Announcement.htm" style="color: #1a9bf2; text-decoration: none">地接客服务协议</a>
            </div>
        </form>
        <script type="text/javascript">
            $("#invatationCode").val(GetQueryStr('invatationCode'));
            jQuery.loadHtml('/pgajax.axd?LOGINOUT=1').done(function () { });
            jQuery.getValidateImg('imgValidata');
            $("#h_title").text("注册");
            $("#username").val("");
            $("#txtValidata").val("");
            $("#J_BtnEmailForm").live("click", function () {
                dologin();
            });
            function dologin() {
                if ($("#username").val() && $("#password").val()) {
                    if ($("#J_BtnEmailForm").val() == "正在注册") {
                        return;
                    }
                    if ($("#chkAgreeProtecol").attr("checked") != "checked") {
                        alert("请同意地接客服务协议！");
                        return;
                    }
                    var _jsParam = new jsonRow();
                    if (!vfcUser($.trim($("#username").val()))) {
                        return;
                    }
                    if (!vfcPassword($.trim($("#password").val()))) {
                        return;
                    }
                    if (!vfcOkPassword($.trim($("#password").val()), $.trim($("#okPassword").val()))) {
                        return;
                    }
                    if (!vfcCode($.trim($("#txtValidata").val()))) {
                        jQuery.getValidateImg('imgValidata');
                        return;
                    }
                    $("#J_BtnEmailForm").val("正在注册");
                    _jsParam.AddCell("ACTION", "REGIST_STEP1");
                    _jsParam.AddCell("USER_NME", $("#username").val());
                    _jsParam.AddCell("USER_PASS", $("#password").val());
                    _jsParam.AddCell("USER_OKPASS", $("#okPassword").val());
                    _jsParam.AddCell("invatationCode", $("#invatationCode").val());
                    _jsParam.AddCell("code", $("#txtValidata").val());
                    ajaxComm(_jsParam);
                } else {
                    alert("注册不成功：请输入登录名、密码、确认密码！");
                }

            };

            function doInit() {
                var _jsParam = new jsonRow();
                _jsParam.AddCell("ACTION", "init");
                _jsParam = addNoAreStatistics(_jsParam, "用户注册", "m0002");
                _jsParam.AddCell("invatationCode", $("#invatationCode").val());
                ajaxComm(_jsParam);
            }
            doInit();

            //验证用户名
            function vfcUser(UserName) {
                if (IsNull(UserName)) {
                    alert("用户名不能为空");
                    return false;
                }
                if (!IsEmail(UserName)) {
                    alert("用户名只能是邮箱");
                    return false;
                }
                if (UserName.toUpperCase().indexOf("地接客") >= 0 || UserName.toUpperCase().indexOf("DJK") >= 0 || UserName.toUpperCase().indexOf("DIJIEKE") >= 0) {
                    alert("用户名不可用");
                    return false;
                }
                return true;
            }

            //验证密码
            function vfcPassword(Password) {
                if (IsNull(Password)) {
                    alert("密码不能为空!");
                    return false;
                }
                if (!islength(Password, 6, 16) || !isStr(Password)) {
                    alert("密码只能在6~16位数字和字母!");
                    return false;
                }
                return true;
            }

            //验证确认密码
            function vfcOkPassword(Password, ComfirPassword) {
                if (IsNull(ComfirPassword)) {
                    alert("确认密码不能为空！");
                    return false;
                }
                if (Password != ComfirPassword) {
                    alert("两次密码不一致!");
                    return false;
                }
                return true;
            }

            //验证验证码
            function vfcCode(ValiCode) {
                if (IsNull(ValiCode)) {
                    alert("验证码不能为空");
                    return false;
                }
                if (ValiCode.length != 4) {
                    alert("验证码长度只能是四位");
                    return false;
                }
                if (!isStr(ValiCode)) {
                    alert("验证码只能是数字和字母组合");
                    return false;
                }
                return true;
            }
        </script>
    </div>
</body>
<%=getBodyAfterJs() %>
</html>
